use image::Rgba;

#[derive(Debug, Clone, Copy)]
pub struct Color(pub Rgba<u8>);

impl Color {
    pub const fn rgba(r: u8, g: u8, b: u8, a: u8) -> Color {
        Color(Rgba::<u8>([r, g, b, a]))
    }

    pub const fn rgb(r: u8, g: u8, b: u8) -> Color {
        Color(Rgba::<u8>([r, g, b, 255]))
    }
}

#[macro_export]
macro_rules! color {
    ($r:expr, $g:expr, $b:expr) => {
        Color::rgb($r, $g, $b)
    };
    
    ($r:expr, $g:expr, $b:expr, $a:expr) => {
        Color::rgba($r, $g, $b, $a)
    };
}

impl Color {
    pub fn red() -> Color {
        color!(255, 0, 0)
    }

    pub fn green() -> Color {
        color!(0, 255, 0)
    }

    pub fn blue() -> Color {
        color!(0, 0, 255)
    }

    pub fn white() -> Color {
        color!(255, 255, 255)
    }

    pub fn black() -> Color {
        color!(0, 0, 0)
    }

    pub fn gray() -> Color {
        color!(50, 50, 50)
    }

    pub fn light_gray() -> Color {
        color!(180, 180, 180)
    }
}